import { notFound } from 'next/navigation';
import ThreeLayerDashboardLayout from '@/components/dashboard/ThreeLayerDashboardLayout';

interface UserLayoutProps {
  children: React.ReactNode;
  params: { userId: string };
}

// Simple user validation - in a real app, you'd validate against your database
function isValidUserId(userId: string): boolean {
  // Allow any non-empty alphanumeric userId for demo purposes
  return /^[a-zA-Z0-9]+$/.test(userId) && userId.length > 0;
}

export default function UserLayout({ children, params }: UserLayoutProps) {
  if (!isValidUserId(params.userId)) {
    notFound();
  }

  return (
    <ThreeLayerDashboardLayout userId={params.userId}>
      {children}
    </ThreeLayerDashboardLayout>
  );
} 